package com.ruoyi.exam.domain;

import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.exam.domain.model.LabelModel;


/**
 * 用户分数信息管理对象 exam_user_info
 *
 * @author wky
 * @date 2024-09-19
 */
@Schema(description = "用户分数信息管理对象")
public class ExamUserInfo extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @Schema(title = "$column.columnComment")
    private Long userId;

    /** $column.columnComment */
    @Schema(title = "$column.columnComment")
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String scoreJson;

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setScoreJson(String scoreJson) {
        this.scoreJson = scoreJson;
    }

    public String getScoreJson() {
        return scoreJson;
    }

    public String getAiRequestString() {
        List<LabelModel> from = JSON.parseArray(scoreJson, LabelModel.class);
        StringBuilder stringBuilder = new StringBuilder("我今年的得分情况如下: \n");
        from.forEach(item -> {
            stringBuilder.append("我的")
                    .append(item.getLabel())
                    .append("得分是: ")
                    .append(item.getValue())
                    .append("\n");
        });
        stringBuilder.append("以上是我今年的中国高考的成绩,请给我合适合理大学志愿的建议");
        return stringBuilder.toString();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("userId", getUserId())
                .append("scoreJson", getScoreJson())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .toString();
    }
}
